import {
  LOGIN_INFO
} from './constants'
import Axios from 'axios'
const loginInfo = result => ({
  type: LOGIN_INFO,
  login: result
})
export const login = data => {
  return dispatch => {
    Axios.get('/api/login.json?account=' + data.account + '&password='+ data.password).then(res => {
      if (res.data.success) {
        dispatch(loginInfo(res.data.data))
      }
    })
  }
}